<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" type="text/css" href="__CSS__/main.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__/common.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__/bootstrap.min.css" />
    <script type="text/javascript" src="__EXTEND__/lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="__EXTEND__/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="__EXTEND__/lib/layer/2.4/layer.js"></script>
    <![endif]-->
    <title></title>
</head>
<body>
<div class="contant">
<div class="row">
    <div class="top">业务部>GPS待分配列表</div>
    <div class="content applylist">
        <div class="box">
            <h1>GPS待分配列表</h1>
            <div class="list-block">
                <div class="row">
                    <table class="list">
                        <tr>
                            <th>申请人</th> <th>银行</th><th>银行卡</th> <th>垫资时间</th> <th>备注</th><th>操作</th>
                        </tr>
                        <foreach name="advanceList" item="_v" >
                        <tr>
                            <td>{$_v.user_name}</td>
                            <td>{$_v.bank_name}</td>
                            <td>{$_v.bank_card}</td>
                            <td>{$_v.add_time|date='Y-m-d H:i:s', ###}</td>
                            <td>备注</td>
                            <td>
                                <a class="btn btn-primary" href="{:U('GPS/addEquip?user_id='.$_v['user_id'])}">添加GPS设备</a>&nbsp;&nbsp;
                                <button data-id={$_v.id} class="btn btn-success gps-complete" type="button">完成添加</button>
                            </td>
                        </tr>
                        </foreach>
                    </table>
                </div>
                {$page}
            </div>
        </div>
    </div>
</div>
</div>
<script type="text/javascript">
    $('.gps-complete').click(function(){
        var advanceId = $(this).attr('data-id');
        console.log(advanceId);

        $.ajax({
            type: "POST",
            url: "__URL__/completeAllot",
            data: {
                advanceId:advanceId
            },
            success: function(msg){
                console.log(msg);
                if (msg) {
                    alert('该用户GPS设备已经分配完成');
                }
                window.location.reload();
           }
        });
    });
</script>
</body>
</html>